package com.backstage.controller;

import com.backstage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value = "/admin")
public class AdminController {

    @Autowired
    private UserService userService;

    @Autowired
    private ScopeService scopeService;

    @Autowired
    private ChatroomService chatroomService;

    @Autowired
    private ReportService reportService;

    @Autowired
    private GoodsService goodsService;

    @RequestMapping(value = {"/","index"}, method = RequestMethod.GET)
    public String adminindex(Model model) {
        model.addAttribute("userTotal", userService.selectUserTotal());
        model.addAttribute("scopeTotal", scopeService.selectScopeTotal());
        model.addAttribute("chatroomTotal", chatroomService.selectChatroomTotal());
        model.addAttribute("reportTotal", reportService.selectReportTotal());
        model.addAttribute("goodsTotal", goodsService.selectGoodsTotal());
        return "admin/index";
    }
}
